package com.csun.cmny.provider.job.simple;

import com.csun.cmny.provider.model.dto.SendClockDto;
import com.csun.cmny.provider.service.DmcRpcService;
import com.csun.cmny.provider.service.OpcRpcService;
import com.csun.cmny.util.DateUtil;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.paascloud.elastic.lite.annotation.ElasticJobConfig;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.util.Calendar;
import java.util.Date;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-11-13 10:21
 * @Description: 计算守护佳-智能床垫睡眠数据（每天中午12:01）
 */
@Slf4j
@ElasticJobConfig(cron = "00 01 12 * * ?")
public class CalcSleepDateJob implements SimpleJob {

    @Resource
    private DmcRpcService dmcRpcService;

    /**
     * Execute.
     *
     * @param shardingContext the sharding context
     */
    @Override
    public void execute(final ShardingContext shardingContext) {

        Date date = new Date();

        log.info("定时计算守护佳-智能床垫睡眠数据 ==》 {}", DateUtil.dateToString(date));

        dmcRpcService.calcSleepDate();
    }

}
